function timeTotimeStramp(data,last){
    try{
        let m=data.split(":")
        let time=(parseFloat(m[0])*60+parseFloat(m[1])).toFixed(1)
        // let time=eval(data.toString().replace(":","*60+"))
        if (time>0){
            return time;
        }
    }catch(e){
        // todo
        console.log(e,data.toString().replace(":","*60+"))
    }
    return last;
    
}
function parseLyric(data){
    data=data.toString();
    let listData=data.split("\n");
    let timeList=[];
    let lyricList=[];
    let lstTime=0;
    // console.log("数据解析列表",listData)
    for (let index = 0; index < listData.length; index++) {
        const element = listData[index];
        let m=/\[([0-9\\:\\.]+)\](.*)/.exec(element)
        // console.log("数据解析",m)
        if (m==null)continue;
        lstTime=timeTotimeStramp(m[1],lstTime)
        timeList.push(lstTime);
        lyricList.push(m[2])
    }
    return {timeList,lyricList}

}
export default {
    parseLyric
}